﻿using Abp.Domain.Entities.Auditing;
using SingleUserMall.Authorization.Users;
using SingleUserMall.Items;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace SingleUserMall.Stores
{
    /// <summary>
    /// 店铺
    /// </summary>
    public class Store : FullAuditedEntity
    {
        /// <summary>
        /// 名称
        /// </summary>
        [Required, MaxLength(50)]
        public string Name { get; set; }
        /// <summary>
        /// 用户id
        /// </summary>
        public long UserId { get; set; }
        [ForeignKey("UserId")]
        public virtual User User { get; set; }
        /// <summary>
        /// 图片
        /// </summary>
        [MaxLength(100)]
        public string Picture { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        [MaxLength(200)]
        public string Discription { get; set; }
        /// <summary>
        /// 认证类型
        /// </summary>
        [MaxLength(50)]
        public string AuthType { get; set; }
        /// <summary>
        /// 相关证件
        /// </summary>
        public string CertImages { get; set; }

        /// <summary>
        /// 团购标识
        /// </summary>
        public bool IsGroup { get; set; }

        /// <summary>
        /// 限时购标识
        /// </summary>
        public bool IsTimeLimit { get; set; }
        /// <summary>
        /// 保持零售价标识
        /// </summary>
        public bool IsKeepPrice { get; set; }
        /// <summary>
        /// 审核状态
        /// </summary>
        public StoreVerifyStatus Status { get; set; }
        /// <summary>
        ///商城总销量
        /// </summary>
        public int StoreTotalSale { get; set; }
        /// <summary>
        /// 商铺星级
        /// </summary>
        public int StoreStar { get; set; }
        /// <summary>
        /// 经营范围
        /// </summary>
        public long BusinessScopeId { get; set; }
        //[ForeignKey("BusinessScopeId")]
        //public virtual BusinessScope BusinessScope { get; set; }
        /// <summary>
        /// 店铺经营地址
        /// </summary>
        public string StoreAddress { get; set; }
        /// <summary>
        /// 客服电话
        /// </summary>
        public string CustomerServicePhone { get; set; }
        /// <summary>
        /// 销售总额
        /// </summary>
        public decimal SaleAmount { get; set; }
        /// <summary>
        /// 已结算销售额
        /// </summary>
        public decimal BanlancedSaleAmount { get; set; }
        /// <summary>
        /// 未结算销售额
        /// </summary>
        public decimal UnBanlancedSaleAmount { get; set; }
        /// <summary>
        /// 店铺保证金
        /// </summary>
        public decimal StoreFund { get; set; }
        /// <summary>
        /// 是否非法
        /// </summary>
        public bool IsInvalid { get; set; }
    }

    /// <summary>
    /// 审核状态
    /// </summary>
    public enum StoreVerifyStatus
    {
        /// <summary>
        /// 已驳回
        /// </summary>
        [Description("已驳回")]
        Rejected = -1,
        /// <summary>
        /// 等待审核
        /// </summary>
        [Description("待审核")]
        WaitAudit = 0,
        /// <summary>
        /// 已审核
        /// </summary>
        [Description("已通过")]
        Audited = 1,
    }
}
